var searchKey = "";
var dateTypeName = '';
var defalutAwardsId = 0;
var defalutAwardsName = '';
var defalutAwardsSubId = 0;
var defalutAwardsSubName = '';
var defalutAwardsSubStatus = 0;
var defalutAwardsDateType = 1;
var defalutParticipatorId = 0;
var onloading = false;
var defalutNameSize = 8;
var defalutMsgSize = 2;

/****
 * CSS 切换
 * @param this_
 */
function tabFuc(this_){
    // 避免重复请求
    if (onloading) return;
    onloading = true;

    // 切换css
    $(".date_type").removeClass('bg');
    $(this_).addClass('bg');
    // 加载列表
    $("#voteAwardsNameList").empty();
    defalutAwardsDateType = $(this_).attr("date_type_val");
    $.ajaxSettings.async = true;
    $.get("/portals/vote/jsp/front/awardsData.jsp?dateType="+defalutAwardsDateType, function(resp){
        var html='';
        if (resp.code == 200) {
            resp.data.forEach(function(json){
                html +='<div class="list-one" onclick="selectedVoteAwardsFunc(this)" date_type_val="'+json.dateType+'" awards_id="'+json.id+'" data_name="'+json.name+'">';
                html +=' <div class="single one"></div>';
                html +=' <span class="text">'+json.name+'</span>';
                html +='</div>';
            });
        }else {
            console.log(resp.msg);
        }
        $("#voteAwardsNameList").append(html);
    });
    // 是否显示提名投票
    if(defalutAwardsDateType==1){
        $("#isShowTP").show();
    }else {
        $("#isShowTP").hide();
    }
    onloading = false;
};

/***
 * 选中大奖项（动态加载右侧信息）
 */
function selectedVoteAwardsFunc(this_) {
    // 避免重复请求
    if (onloading) return;
    onloading = true;
    // CSS 切换
    $(".list-one").removeClass('bg');
    $(this_).addClass('bg');
    // 奖项id
    defalutAwardsId = $(this_).attr("awards_id");
    // 获取父级数据类型
    defalutAwardsDateType = $(this_).attr("date_type_val");
    // 获取奖项信息
    dateTypeName = defalutAwardsDateType==1?'年度评优':'季度评优';
    defalutAwardsName = $(this_).attr("data_name");
    // 赋值奖项信息
    $("#dateTypeName").text(dateTypeName);
    $("#voteAwardsName").text(defalutAwardsName);
    // 奖项说明
    $.ajaxSettings.async = false;
    $.get("/portals/vote/jsp/voteAwards/info.jsp?id="+defalutAwardsId, function(resp){
        if (resp.code == 200){
            $("#voteAwardsAbout").html(resp.data.about);
            $("#voteAwardsRegular").html(resp.data.regular);
            $("#voteAwardsStartTime").text(resp.data.startTime);
            $("#voteAwardsEndTime").text(resp.data.endTime.substring(0,10)+"23:59:59");
            switch (resp.data.status) {
                case -1:
                    $("#voteAwardsStatus").text("已结束");
                    break;
                case 0:
                    $("#voteAwardsStatus").text("未开始");
                    break;
                default:
                    $("#voteAwardsStatus").text("进行中");
                    break;
            }
        } else {
            console.log(resp.msg);
        }
    });
    // 子奖项信息(默认展示第一个项目)
    $.get("/portals/vote/jsp/front/awardsSubData.jsp?awardsId="+defalutAwardsId, function(resp){
        var html = '';
        if (resp.code==200){
            resp.data.forEach(function(obj){
                if (defalutAwardsSubId==0) {
                    defalutAwardsSubId = obj.id;
                    defalutAwardsSubStatus = obj.status;
                    html +='<div class="s-one bd" onclick="selectedVoteAwardsSubFunc(this)" awards_sub_id="'+obj.id+'" awards_sub_status="'+obj.status+'">'+obj.name+'</div>';
                } else {
                    html +='<div class="s-one" onclick="selectedVoteAwardsSubFunc(this)"  awards_sub_id="'+obj.id+'" awards_sub_status="'+obj.status+'">'+obj.name+'</div>';
                }
            })
        } else {
            console.log(msg);
        }
        $("#voteAwardsSubnameNames").empty();
        $("#voteAwardsSubnameNames").append(html);
    });
    // 加载名单
    $.get("/portals/vote/jsp/front/names.jsp?awardsSubnameId="+defalutAwardsSubId, function(resp){
        var html='';
        if (resp.code == 200 ){
            resp.data.forEach(function(json){
                if (json.winStatus){                                                  // 是否有获奖标识
                    html +='<div class="people getJiang"  >';
                    html +='<div class="hj"><img src="../img/static/hj.png" alt=""></div>' +
                        '   <div class="jz"><img src="../img/static/jz.png" alt=""></div>';
                } else {
                    html +='<div class="people "  >';
                }
                html +=' <div class="people-img"  onclick="shwoMedel('+json.id+')">';
                html +='    <img src="'+json.nominatorPhoto+'" class="img" alt="">';
                if (defalutAwardsDateType==1){
                    html +='    <div class="img-ps">';
                    html +='        票数'+json.votesNum;
                    html +='    </div>';
                }
                html +=' </div>';
                html +=' <div class="people-info">';
                html +='    <span class="w">姓名：</span>';
                html +='    <span>'+json.memberNames+'</span>';
                html +=' </div>';
                html +=' <div class="people-info">';
                html +='    <span class="w">部门：</span>';
                html +='    <span>'+json.nominatorDeptName+'</span>';
                html +=' </div>';
                html +=' <div class="people-info">';
                html +='    <span class="w">职位：</span>';
                html +='    <span>'+json.nominatorPosition+'</span>';
                html +=' </div>' ;
                html +=' <div class="people-flower"  onclick="shwoMedel('+json.id+')">' ;
                html +='    <div>' ;
                html +='        <span class="inb"><img src="../img/static/flower.png" class="fl" alt=""> <span class="ml10 fl f12 c9e9e9e">'+json.flowerNum+'</span> </span>' ;
                html +='    </div>' ;
                html +='    <div class="l"> ' ;
                html +='        <span  class="inb"><img src="../img/static/message.png" class="fl" alt=""><span class="ml10 fl f12 c9e9e9e">'+json.messageNum+'</span></span>';
                html +='    </div>' ;
                html +=' </div>' ;
                if (defalutAwardsDateType==1 && defalutAwardsSubStatus==1){
                    html +=' <div class="people-btn-gray" id="peopleBtn"> 投票 </div>';
                }
                html +='</div>';
            });
        } else {
            console.log(resp.msg);
        }

        $("#nameList").empty();
        $("#nameList").append(html);
    });
    // 默认面包屑
    $("#search-l").val('');
    defalutAwardsSubName=$(this_).text();
    $("#voteAwardsName").text(defalutAwardsName);
    $("#voteAwardsSubnameName").text(defalutAwardsSubName);
    onloading = false;
}

/****
 * 选中子奖项，加载名单
 * @param this_
 */
function selectedVoteAwardsSubFunc(this_){
    // 避免重复请求
    if (onloading) return;
    onloading = true;
    // CSS 切换
    $(".s-one").removeClass('bd');
    $(this_).addClass('bd');
    // 筛选条件
    searchKey = $("#search-l").val();
    defalutAwardsSubId = $(this_).attr("awards_sub_id");
    defalutAwardsSubStatus = $(this_).attr("awards_sub_status");
    // 同步加载
    $.ajaxSettings.async = true;
    $.get("/portals/vote/jsp/front/names.jsp?awardsSubnameId="+defalutAwardsSubId+'&searchKey='+searchKey, function(resp){
        var html='';
        if (resp.code == 200 ){
            var index = 1;
            var data = resp.data;
            if (data.length>0){
                data.forEach(function(json){
                    if (json.winStatus){                                                  // 是否有获奖标识
                        html +='<div class="people getJiang '+(index>defalutNameSize?'hidden':'')+'"  >';
                        html +='<div class="hj"><img src="../img/static/hj.png" alt=""></div>' +
                            '   <div class="jz"><img src="../img/static/jz.png" alt=""></div>';
                    } else {
                        html +='<div class="people '+(index>defalutNameSize?'hidden':'')+' "  >';
                    }
                    html +=' <div class="people-img"  onclick="shwoMedel('+json.id+')">';
                    html +='    <img src="'+json.nominatorPhoto+'" class="img" alt="">';
                    if (defalutAwardsDateType==1){
                        html +='    <div class="img-ps">';
                        html +='        票数'+json.votesNum;
                        html +='    </div>';
                    }
                    html +=' </div>';
                    html +=' <div class="people-info">';
                    html +='    <span class="w">姓名：</span>';
                    html +='    <span>'+json.memberNames+'</span>';
                    html +=' </div>';
                    html +=' <div class="people-info">';
                    html +='    <span class="w">部门：</span>';
                    html +='    <span>'+json.nominatorDeptName+'</span>';
                    html +=' </div>';
                    html +=' <div class="people-info">';
                    html +='    <span class="w">职位：</span>';
                    html +='    <span>'+json.nominatorPosition+'</span>';
                    html +=' </div>' ;
                    html +=' <div class="people-flower"  onclick="shwoMedel('+json.id+')">' ;
                    html +='    <div>' ;
                    html +='        <span class="inb"><img src="../img/static/flower.png" class="fl" alt=""> <span class="ml10 fl f12 c9e9e9e">'+json.flowerNum+'</span> </span>' ;
                    html +='    </div>' ;
                    html +='    <div class="l"> ' ;
                    html +='        <span  class="inb"><img src="../img/static/message.png" class="fl" alt=""><span class="ml10 fl f12 c9e9e9e">'+json.messageNum+'</span></span>';
                    html +='    </div>' ;
                    html +=' </div>' ;
                    if (defalutAwardsDateType==1 && defalutAwardsSubStatus==1){
                        html +=' <div class="people-btn" id="peopleBtn" onclick="shwoMedel(this)"> 投票 </div>';
                    }else if (defalutAwardsDateType==1){
                        html +=' <div class="people-btn-gray" id="peopleBtn"> 投票 </div>';
                    }
                    html +='</div>';
                    index++;
                });
            } else {
                html +='<div class="tc c9e9e9e">暂无数据</div>';
            }
        } else {
            console.log(resp.msg)
        }
        $("#namesMoreBtn").removeClass("hidden");
        if (data.length<=defalutNameSize) $("#namesMoreBtn").addClass("hidden");
        $("#nameList").empty();
        $("#nameList").append(html);
    });
    // 默认面包屑
    defalutAwardsSubName=$(this_).text();
    $("#voteAwardsName").text(defalutAwardsName);
    $("#voteAwardsSubnameName").text(defalutAwardsSubName);
    onloading=false;
}

/****
 * 模板窗
 */
function shwoMedel(id) {
    // 避免重复请求
    if (onloading) return;
    onloading = true;
    defalutParticipatorId = id;
    // 查询用户资料
    $.ajaxSettings.async = false;
    $.get("/portals/vote/jsp/voteAwardsParticipator/info.jsp?id="+defalutParticipatorId, function(resp){
        if (resp.code == 200 ){
            var data = resp.data;
            $("#awardsParticipatorPhoto").attr("src",data.nominatorPhoto);
            if (data.nominatorType==1){ // 个人提名
                $("#awardsParticipatorName").text(data.memberNames);
                $("#awardsParticipatorDeptName").text(data.nominatorDeptName);
                $("#awardsParticipatorPosition").text(data.nominatorPosition);
                $("#awardsParticipatorType1").show();
                $("#awardsParticipatorType2").hide();
            } else {                    // 团队提名
                $("#awardsParticipatorPoject").text(data.pojectNum);
                $("#awardsParticipatorPojectMember").text(data.memberNames);
                $("#awardsParticipatorType1").hide();
                $("#awardsParticipatorType2").show();
            }
            $("#awardsParticipatorVotesNum").text(data.votesNum);
            $("#awardsParticipatorFlowerNum").text(data.flowerNum);
            $("#awardsParticipatorMessageNum").text(data.messageNum);
            if (defalutAwardsDateType==1){
                $("#awardsParticipatorVotesNum:parent").show();
            }else {
                $("#awardsParticipatorVotesNum:parent").hide();
            }
            $("#awardsParticipatorComplete").html(data.complete);
            $("#awardsParticipatorInfluence").html(data.influence);
            $("#awardsParticipatorPojectGoal").text(data.projectGoal);
        } else {
            console.log(resp.msg)
        }
    });
    // 留言信息
    $("#message").val("");
    $.get("/portals/vote/jsp/voteAwardsMessage/list.jsp?awardsParticipatorId="+defalutParticipatorId, function(resp){
        if (resp.code == 200 ){
            // 总数
            $("#msgCount").text(resp.data.length);
            // 循环
            var html = '';
            var index = 1;
            resp.data.forEach(function(json){
                html +='<div class="df liuyan '+(index>defalutMsgSize?'hidden':'')+'">';
                html +=' <div class="liuyan-toxiang">';
                html +='  <img src="'+json.photo+'">';
                html +=' </div>';
                html +=' <div class="liuyan-name">';
                html +='   <div class="mt5">'+json.name+' <span class="fr c9e9e9e f12">'+json.timer+'</span></div>';
                html +='   <div class="c9e9e9e f12 mt10">'+json.dept+'</div>';
                html +='   <div class="c9e9e9e f12 mt10">'+json.message+'</div>';
                html +='  </div>';
                html +='</div>';
                index++;
            });
            $("#msgMoreBtn").removeClass("hidden");
            if(resp.data.length<=defalutMsgSize){
                $("#msgMoreBtn").addClass("hidden");
            }
        } else {
            $("#msgCount").text(0);
            console.log(resp.msg)
        }

        $("#msgList").empty();
        $("#msgList").append(html);
    });
    voteAndFlowerFunc(defalutParticipatorId);
    // 是否显示投票的窗口
    if (defalutAwardsDateType == 1){
        $("#isShowTPFunc").show();
    }else {
        $("#isShowTPFunc").hide();
    }
    // 展示
    $("#mengban").show(100);
    onloading = false;
}

/*****
 * 当前用户对提名名单的投票和送花信息
 * @param participatorId
 */
function voteAndFlowerFunc(participatorId) {
    $.get("/portals/vote/jsp/front/getVoteAndFlower.jsp?awardsParticipatorId="+participatorId,function(resp){
        if(resp.code == 200){
            // 是否投过票
            if (resp.data.votesStatus){
                $("#tpBtn").text("已投票").unbind();
            }else {
                $("#tpBtn:parent").addClass("c5f9dab");
                $("#tpBtn").text("投票").one("click", function(){
                    $.post("/portals/vote/jsp/voteAwardsBallot/add.jsp?awardsParticipatorId="+participatorId,function (resp2) {
                        if (resp2.code == 200 ){
                            $("#awardsParticipatorVotesNum").text($("#awardsParticipatorVotesNum").text()*1+1);
                            $("#tpBtn").text("已投票").unbind();
                            $("#tpBtn:parent").removeClass("c5f9dab");
                        } else {
                            console.log(resp2.msg);
                        }
                    });
                });
            }
            // 是否送过花
            if (resp.data.flowerStatus){
                $("#shBtn").text("已送花").unbind();
            }else {
                $("#shBtn:parent").addClass("c5f9dab");
                $("#shBtn").text("送花").one("click", function(){
                    $.post("/portals/vote/jsp/voteAwardsFlower/add.jsp?awardsParticipatorId="+participatorId,function (resp3) {
                        if (resp3.code == 200 ){
                            $("#awardsParticipatorFlowerNum").text($("#awardsParticipatorFlowerNum").text()*1+1);
                            $("#shBtn").text("已送花").unbind();
                            $("#shBtn:parent").removeClass("c5f9dab");
                        } else {
                            console.log(resp3.msg)
                        }
                    });
                });
            }
        }else {
            console.log(resp.msg)
        }
    });
}

/***
 * 留言
 */
function addMsgFunc(){

    // 拼装参数
    var obj = new Object();
    obj.awardsParticipatorId = defalutParticipatorId;
    obj.message = $("#message").val();
    if (obj.message == undefined || obj.message == '') return;

    // 避免重复请求
    if (onloading) return;
    onloading = true;

    // 发起请求
    $.post("/portals/vote/jsp/voteAwardsMessage/add.jsp", obj, function(resp){
        if (resp.code == 200){
            $("#awardsParticipatorMessageNum").text($("#awardsParticipatorMessageNum").text()*1+1);
        } else if (resp.msg=='请重新登录'){
            layer.alert("请重新登录");
        }else {
            console.error(resp.msg)
        }
    });

    // 重新加载
    $("#message").val("");
    $.get("/portals/vote/jsp/voteAwardsMessage/list.jsp?awardsParticipatorId="+defalutParticipatorId, function(resp){
        if (resp.code == 200){
            var data = resp.data;
            // 总数
            $("#msgCount").text(data.length);
            // 循环
            var html = '';
            data.forEach(function(json){
                html +='<div class="df liuyan">';
                html +=' <div class="liuyan-toxiang">';
                html +='  <img src="'+json.photo+'">';
                html +=' </div>';
                html +=' <div class="liuyan-name">';
                html +='   <div class="mt5">'+json.name+' <span class="fr c9e9e9e f12">'+json.timer+'</span></div>';
                html +='   <div class="c9e9e9e f12 mt10">'+json.dept+'</div>';
                html +='   <div class="c9e9e9e f12 mt10">'+json.message+'</div>';
                html +='  </div>';
                html +='</div>';
            });
            $("#msgList").empty();
            $("#msgList").append(html);
        }else {
            $("#msgCount").text(0);
            console.log(resp.msg)
        }
    });
    onloading = false;
}

/***
 * 加载更多提名信息
 */
function namesMoreFunc(){
    $(".people").removeClass("hidden");
    $("#namesMoreBtn").addClass("hidden");
}

/***
 * 加载更多留言信息
 */
function msgMoreFunc(){
    $(".liuyan").removeClass("hidden");
    $("#msgMoreBtn").addClass("hidden");
}

/***
 * 条件搜索
 */
function searchFunc() {
    // 避免重复请求
    if (onloading) return;
    onloading = true;
    // 筛选条件
    searchKey = $("#search-l").val();
    // 同步加载
    $.ajaxSettings.async = true;
    // 数据默认加载名单列表
    $.get("/portals/vote/jsp/front/names.jsp?awardsSubnameId="+defalutAwardsSubId+(undefined!=searchKey&&searchKey!=''?"&searchKey="+searchKey:''), function(resp){
        var html='';
        if (resp.code == 200){
            var index = 1;
            if (resp.data.length == 0){
                html +='<div class="tc c9e9e9e">暂无数据</div>';
            } else {
                resp.data.forEach(function(json){
                    if (json.winStatus){                                                  // 是否有获奖标识
                        html +='<div class="people getJiang '+(index>defalutNameSize?'hidden':'')+'"  >';
                        html +='<div class="hj"><img src="../img/static/hj.png" alt=""></div>' +
                            '   <div class="jz"><img src="../img/static/jz.png" alt=""></div>';
                    } else {
                        html +='<div class="people '+(index>defalutNameSize?'hidden':'')+' "  >';
                    }
                    html +=' <div class="people-img">';
                    html +='    <img src="'+json.nominatorPhoto+'" class="img">';
                    if (defalutAwardsDateType==1){
                        html +='    <div class="img-ps">';
                        html +='        票数'+json.votesNum;
                        html +='    </div>';
                    }
                    html +=' </div>';
                    html +=' <div class="people-info">';
                    html +='    <span class="w">姓名：</span>';
                    html +='    <span>'+stringSimplifyFunc(json.memberNames)+'</span>';
                    html +=' </div>';
                    html +=' <div class="people-info">';
                    html +='    <span class="w">部门：</span>';
                    html +='    <span>'+stringSimplifyFunc(json.nominatorDeptName)+'</span>';
                    html +=' </div>';
                    html +=' <div class="people-info">';
                    html +='    <span class="w">职位：</span>';
                    html +='    <span>'+stringSimplifyFunc(json.nominatorPosition)+'</span>';
                    html +=' </div>' ;
                    html +=' <div class="people-flower" onclick="shwoMedel('+json.id+')">' ;
                    html +='    <div >' ;
                    html +='        <span class="inb"><img src="../img/static/flower.png" class="fl" alt="送花"> <span class="ml10 fl f12 c9e9e9e">'+json.flowerNum+'</span> </span>' ;
                    html +='    </div>' ;
                    html +='    <div class="l"> ' ;
                    html +='        <span  class="inb"><img src="../img/static/message.png" class="fl" alt="留言"><span class="ml10 fl f12 c9e9e9e">'+json.messageNum+'</span></span>';
                    html +='    </div>' ;
                    html +=' </div>' ;
                    if (defalutAwardsDateType==1 && defalutAwardsSubStatus==1){
                        html +=' <div class="people-btn" id="peopleBtn" onclick="lookDetailFunc('+json.id+')"> 投票 </div>';
                    }else if (defalutAwardsDateType==1){
                        html +=' <div class="people-btn-gray" id="peopleBtn"> 投票 </div>';
                    }
                    html +=' <div class="people-btn"  onclick="lookDetailFunc('+json.id+')">';
                    html +=' 详情';
                    html +=' </div>';
                    html +='</div>';
                    index++;
                });
            }

            $("#namesMoreBtn").removeClass("hidden");
            if (resp.data.length<=defalutNameSize) $("#namesMoreBtn").addClass("hidden");
        } else {
            console.log(resp.msg)
        }
        $("#nameList").empty();
        $("#nameList").append(html);
    });
    onloading = false;
}

/***
 * 名称太长截取调一部分
 * @param str_
 */
function stringSimplifyFunc(str_){
    if (str_.length>11){
        return str_.substring(0,11)+".."
    }
    return str_;
}

$(function() {
    // 避免重复请求
    if (onloading) return;
        onloading = true;
    // 数据默认加载年度奖项
    $.ajaxSettings.async = false;
    $.get("/portals/vote/jsp/front/awardsData.jsp?dateType="+defalutAwardsDateType,function(resp){
        var html='';
        if (resp.code == 200){
            resp.data.forEach(function(json){
                if (defalutAwardsId == 0){
                    defalutAwardsId = json.id;
                    defalutAwardsName = json.name;
                    html +='<div class="list-one bg" onclick="selectedVoteAwardsFunc(this)" date_type_val="'+defalutAwardsDateType+'" awards_id="'+json.id+'" data_name="'+json.name+'">';
                } else {
                    html +='<div class="list-one" onclick="selectedVoteAwardsFunc(this)" date_type_val="'+defalutAwardsDateType+'" awards_id="'+json.id+'" data_name="'+json.name+'">';
                }
                html +=' <div class="single one"></div>';
                html +=' <span class="text">'+json.name+'</span>';
                html +='</div>';
            });
        } else {
            console.log(resp.msg)
        }
        $("#voteAwardsNameList").append(html);
    });
    // 加载默认年度奖项信息
    $.get("/portals/vote/jsp/voteAwards/info.jsp?id="+defalutAwardsId, function(resp){
        if (resp.code == 200 ){
            var data = resp.data;
            $("#voteAwardsAbout").html(data.about);
            $("#voteAwardsRegular").html(data.regular);
            $("#voteAwardsStartTime").text(data.startTime);
            $("#voteAwardsEndTime").text(data.endTime.substring(0,10)+" 23:59:59");
            switch (data.status) {
                case -1:
                    $("#voteAwardsStatus").text("已结束");
                    break;
                case 0:
                    $("#voteAwardsStatus").text("未开始");
                    break;
                default:
                    $("#voteAwardsStatus").text("进行中");
                    break;
            }
        } else {
            console.log(resp.msg)
        }
    });
    // 加载默认子奖项列表
    $.get("/portals/vote/jsp/front/awardsSubData.jsp?awardsId="+defalutAwardsId, function(resp){
        var html = '';
        if (resp.code == 200){
            resp.data.forEach(function(obj){
                if (defalutAwardsSubId==0) {
                    defalutAwardsSubId = obj.id;
                    defalutAwardsSubName = obj.name;
                    defalutAwardsSubStatus = obj.status;
                    html +='<div class="s-one bd" onclick="selectedVoteAwardsSubFunc(this)"  awards_sub_id="'+obj.id+'"  awards_sub_status="'+obj.status+'">'+obj.name+'</div>';
                } else {
                    html +='<div class="s-one" onclick="selectedVoteAwardsSubFunc(this)"  awards_sub_id="'+obj.id+'"  awards_sub_status="'+obj.status+'">'+obj.name+'</div>';
                }
            })
        }else {
            console.log(resp.msg)
        }
        $("#voteAwardsSubnameNames").empty();
        $("#voteAwardsSubnameNames").append(html);
    });
    // 加载默认子奖项提名名单
    $.get("/portals/vote/jsp/front/names.jsp?awardsSubnameId="+defalutAwardsSubId+'&searchKey='+searchKey, function(resp){
        var html='';
        if (resp.code == 200){
            var index = 1;
            resp.data.forEach(function(json){
                if (json.winStatus){                                                  // 是否有获奖标识
                    html +='<div class="people getJiang '+(index>defalutNameSize?'hidden':'')+'"  >';
                    html +='<div class="hj"><img src="../img/static/hj.png" alt=""></div>' +
                        '   <div class="jz"><img src="../img/static/jz.png" alt=""></div>';
                } else {
                    html +='<div class="people '+(index>defalutNameSize?'hidden':'')+' "  >';
                }
                html +=' <div class="people-img" onclick="shwoMedel('+json.id+')">';
                html +='    <img src="'+json.nominatorPhoto+'" class="img">';
                if (defalutAwardsDateType==1){
                    html +='    <div class="img-ps">';
                    html +='        票数'+json.votesNum;
                    html +='    </div>';
                }
                html +=' </div>';
                html +=' <div class="people-info">';
                html +='    <span class="w">姓名：</span>';
                html +='    <span>'+stringSimplifyFunc(json.memberNames)+'</span>';
                html +=' </div>';
                html +=' <div class="people-info">';
                html +='    <span class="w">部门：</span>';
                html +='    <span>'+stringSimplifyFunc(json.nominatorDeptName)+'</span>';
                html +=' </div>';
                html +=' <div class="people-info">';
                html +='    <span class="w">职位：</span>';
                html +='    <span>'+stringSimplifyFunc(json.nominatorPosition)+'</span>';
                html +=' </div>' ;
                html +=' <div class="people-flower" onclick="shwoMedel('+json.id+')">' ;
                html +='    <div >' ;
                html +='        <span class="inb"><img src="../img/static/flower.png" class="fl" alt="送花"> <span class="ml10 fl f12 c9e9e9e">'+json.flowerNum+'</span> </span>' ;
                html +='    </div>' ;
                html +='    <div class="l"> ' ;
                html +='        <span  class="inb"><img src="../img/static/message.png" class="fl" alt="留言"><span class="ml10 fl f12 c9e9e9e">'+json.messageNum+'</span></span>';
                html +='    </div>' ;
                html +=' </div>' ;
                if (defalutAwardsDateType==1 && defalutAwardsSubStatus==1){
                    html +=' <div class="people-btn" id="peopleBtn" onclick="shwoMedel('+json.id+')"> 投票 </div>';
                }else if (defalutAwardsDateType==1){
                    html +=' <div class="people-btn-gray" id="peopleBtn"> 投票 </div>';
                }
                html +='</div>';
                index++;
            });
            $("#namesMoreBtn").removeClass("hidden");
            if (resp.data.length<=defalutNameSize) $("#namesMoreBtn").addClass("hidden");
        } else {
            console.log(resp.msg)
        }
        $("#nameList").empty();
        $("#nameList").append(html);
    });
    // 默认面包屑
    $("#dateTypeName").text("年度评优");
    $("#voteAwardsName").text(defalutAwardsName);
    $("#voteAwardsSubnameName").text(defalutAwardsSubName);
    onloading = false;
});